home *** CD-ROM | disk | FTP | other *** search
- #include <ctype.h> /* Character class tests: isdigit, toupper, */
- #include <stdarg.h> /* Variable length argument lists. */
- #include <string.h> /* String functions: strcat, strcpy, */
- #include <stdlib.h> /* rand, RAND_MAX */
- #include <time.h> /* Time utilities */
- #include <stdio.h> /* File storage & retrieval */
-
- typedef struct i_node *item_ptr;
-
- typedef struct i_node
- { item_ptr prev;
- short question_Num;
- short times_Missed;
- short times_Answered;
- item_ptr next;
- } item_node;
-
- #define value question_Num
- #define MAX_SIZE 32766
- #define AT_END 32767
- #define NO_ERROR '\0'
- #define MAX_ERROR_LENGTH 256
- #define MAX_FILENAME_LENGTH 32
- #define SET_TIME 1
- #define DONT_SET 0
- #define MEM_ERROR "Ran out of memory\n"
- #define INVALID_TARG_CHAR "Invalid target list char, default set\n"
- #define NO_INS_LIST "No insert positions list, can't execute\n"
- #define ITEM_TOO_LARGE "Item larger than question pool size\n"
-
-
-
- enum insert_Techniques
- { DII = 0,
- RDII,
- RDIns,
- RDInt,
- RFII,
- EC
- };
-
-
- typedef struct global_space
- { short insert_technique_Code;
- short smallest_Position;
- short fewest_Insertions;
- short num_to_Retire;
- short num_Retired;
- short max_item_Num;
- item_ptr incorrect_Head;
- item_ptr incorrect_Tail;
- item_ptr replenish_Head;
- item_ptr replenish_Tail;
- item_ptr future_queue_Head;
- item_ptr future_queue_Tail;
- item_ptr long_list_Head;
- item_ptr long_list_Tail;
- item_ptr retired_items_Head;
- item_ptr retired_items_Tail;
- item_ptr hard_list_Head;
- item_ptr hard_list_Tail;
- item_ptr resurrect_Ptr;
- time_t start_Time;
- long time_spent_Current;
- long time_spent_Previous;
- short questions_answered_Current;
- short questions_answered_Previous;
- short questions_correct_Current;
- short questions_correct_Previous;
- char error_Message [MAX_ERROR_LENGTH];
-
- } global_struct;
-
- typedef struct global_space *global_ptr;
-
- /* Declare toolbox routines used */
-
- extern pascal Ptr NewPtr (long);
- extern pascal void DisposPtr (void *);
-
- /* Prototypes for primary functions (in order of appearance) */
- void CreateDrill (global_ptr *ds_Handle, short num_of_Questions, short num_of_Repeats,
- short question_pool_Size, char orientation_Char,
- char *insert_Technique, char *incorrect_Positions, ...);
- void Store (global_ptr ds, char *student_ID, char *drill_ID,
- char *author_Variables);
- char * Restore (global_ptr *ds_Handle, char *student_ID, char *drill_ID);
- short Next (global_ptr ds);
- void Correct (global_ptr ds);
- void Incorrect (global_ptr ds);
- void Requeue (global_ptr ds, short item_Num, char *requeue_Positions,
- char target_list_Char);
- void Purge (global_ptr ds, char *item_or_Pos, char target_list_Char);
- void Retire (global_ptr ds, short item_Num);
- void Insert (global_ptr ds, short item_Num, char *insert_Positions,
- char target_list_Char);
- void Pad (global_ptr ds, char *pad_Str, char target_list_Char);
-
- long RetrieveInfo (global_ptr ds, short info_Request, ...);
- void Dispose (global_ptr *ds_Handle);
- char * GetErrorMessage (global_ptr ds);
-
- /* Prototypes for secondary functions (in order of appearance) */
- void Add_to_FQ (global_ptr ds, short copy_Amount, char source_list_Char);
- void Build_Hard_List (global_ptr ds, short hard_list_Goal, char hard_list_Form,
- char source_list_Char);
- item_ptr Check_Lists (global_ptr ds, short target_Item);
- void Copy_Node_Data (global_ptr ds, item_ptr source_Node, item_ptr target_Node);
- void Copy_List (global_ptr ds, item_ptr source_Head,
- item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
- void Define_Filename (global_ptr ds, char *student_ID, char *drill_ID, char *file_Name);
- void Dispose_Global_Space (global_ptr *ds_Handle);
- void Dispose_List (global_ptr ds, item_ptr *list_head_Handle,
- item_ptr *list_tail_Handle);
- void Dispose_Node (global_ptr ds, item_ptr node_Ptr,
- item_ptr *list_head_Handle, item_ptr *list_tail_Handle);
- short Encode_Insert_Technique (global_ptr ds, char *technique_Str);
- item_ptr First_Occurrence (global_ptr ds, short item_num, item_ptr list_Ptr);
- short Get_List_Length (global_ptr ds, item_ptr list_Ptr);
- item_ptr Get_Nth (global_ptr ds, short ds_N, item_ptr list_Ptr);
- void Get_Time (global_ptr ds, short ds_Set);
- short Greater_Than_Previous (global_ptr ds, item_ptr test_Node);
- void Insert_List (global_ptr ds, item_ptr ins_Node, item_ptr positions_Ptr,
- item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
- void Insert_Node (global_ptr ds, item_ptr ins_Node, short ins_Pos,
- item_ptr *list_head_Handle, item_ptr *list_tail_Handle);
- void Make_Global_Space (global_ptr *ds_Handle);
- item_ptr Make_Node (global_ptr ds);
- short Num_Occurrences (global_ptr ds, short item_Num, item_ptr list_Head);
- void Replenish (global_ptr ds);
- void Scramble_Long_List (global_ptr ds);
- void Set_Lists (global_ptr ds, char *target_list_char_Ptr,
- item_ptr **list_head_handle_Ptr, item_ptr **list_tail_handle_Ptr);
- short Size_Needed (global_ptr ds, item_ptr list_Ptr);
- void Str_to_Linked_List (global_ptr ds, char *source_Str, item_ptr *list_Head_Handle,
- item_ptr *list_Tail_Handle, char *error_Tag);
- void Update (global_ptr ds, item_ptr update_List, item_ptr update_Node);
-